<template>
  <div>
    <el-form :model="addForm" label-width="80px">
      <el-form-item label="学号">
        <el-input v-model="addForm.code" />
      </el-form-item>
      <el-form-item label="姓名">
        <el-input v-model="addForm.fullName" />
      </el-form-item>
      <el-form-item label="地址">
        <el-input v-model="addForm.address" />
      </el-form-item>
      <el-form-item label="班级">
        <el-input v-model="addForm.gender" />
      </el-form-item>
      <el-form-item label="主修课程">
        <el-input v-model="addForm.major" />
      </el-form-item>
      <el-form-item label="修改时间">
        <el-input v-model="addForm.dateModified" />
      </el-form-item>
    </el-form>
  </div>
</template>

<script>
export default {
  name: 'Smodified',
  props: ['student'],
  data() {
    return {
      addForm: {
        code: '',
        name: '',
        address: '',
        gender: '',
        major: '',
        dateModified: this.formatDate(new Date())
      }
    }
  },
  methods: {
    created() {
      this.addForm.code = this.student.code
      this.addForm.fullName = this.student.fullName
      this.addForm.address = this.student.address
      this.addForm.grade = this.student.grade
    },
    formatDate(now) {
      const year = now.getFullYear()
      const month = now.getMonth() + 1
      const date = now.getDate()
      const hour = now.getHours()
      const minute = now.getMinutes()
      const second = now.getSeconds()
      return year + '-' + month + '-' + date + ' ' + hour + ':' + minute + ':' + second
    }
  }
}
</script>

<style scoped>

</style>
